package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.EducationTrainingMapper;
import com.ruoyi.system.domain.EducationTraining;
import com.ruoyi.system.service.IEducationTrainingService;

/**
 * 教育培训经历Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-25
 */
@Service
public class EducationTrainingServiceImpl implements IEducationTrainingService 
{
    @Autowired
    private EducationTrainingMapper educationTrainingMapper;

    /**
     * 查询教育培训经历
     * 
     * @param id 教育培训经历主键
     * @return 教育培训经历
     */
    @Override
    public EducationTraining selectEducationTrainingById(Long id)
    {
        return educationTrainingMapper.selectEducationTrainingById(id);
    }

    /**
     * 查询教育培训经历列表
     * 
     * @param educationTraining 教育培训经历
     * @return 教育培训经历
     */
    @DataScope(deptAlias = "d", userAlias = "u")
    @Override
    public List<EducationTraining> selectEducationTrainingList(EducationTraining educationTraining)
    {
        return educationTrainingMapper.selectEducationTrainingList(educationTraining);
    }

    /**
     * 新增教育培训经历
     * 
     * @param educationTraining 教育培训经历
     * @return 结果
     */
    @Override
    public int insertEducationTraining(EducationTraining educationTraining)
    {
        educationTraining.setUserId(SecurityUtils.getUserId());
        educationTraining.setDeptId(SecurityUtils.getDeptId());
        educationTraining.setCreateTime(DateUtils.getNowDate());
        return educationTrainingMapper.insertEducationTraining(educationTraining);
    }

    /**
     * 修改教育培训经历
     * 
     * @param educationTraining 教育培训经历
     * @return 结果
     */
    @Override
    public int updateEducationTraining(EducationTraining educationTraining)
    {
        educationTraining.setUpdateTime(DateUtils.getNowDate());
        return educationTrainingMapper.updateEducationTraining(educationTraining);
    }

    /**
     * 批量删除教育培训经历
     * 
     * @param ids 需要删除的教育培训经历主键
     * @return 结果
     */
    @Override
    public int deleteEducationTrainingByIds(Long[] ids)
    {
        return educationTrainingMapper.deleteEducationTrainingByIds(ids);
    }

    /**
     * 删除教育培训经历信息
     * 
     * @param id 教育培训经历主键
     * @return 结果
     */
    @Override
    public int deleteEducationTrainingById(Long id)
    {
        return educationTrainingMapper.deleteEducationTrainingById(id);
    }
}
